package com.fm.controller;

import com.fm.entity.EquipmentTopic;
import com.fm.entity.ProductTopic;
import com.fm.service.EquipmentTopicService;
import com.fm.service.ProductTopicService;
import com.fm.utils.R;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * Created by Administrator on 2018/7/30 0030.
 */
@RestController
@RequestMapping("/api/equipmentTopic")
public class EquipmentTOPICController extends MBaseController<EquipmentTopic, EquipmentTopicService>{

    @Override
    public EquipmentTopic beforeList(Map t) {
        EquipmentTopic topic = new EquipmentTopic();
        topic.setEquipmentId(Integer.parseInt((String) t.get("equipmentId")));
        return topic;
    }

    @Override
    public void beforeInsert(EquipmentTopic topic, HttpServletRequest request) {
        topic.setIsSystem(0);
    }

    @RequestMapping(value = "/getTopics")
    public R getTopics(Integer id) {
        return R.ok().put("data",baseService.getTopics(id));
    }
}
